/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.jSkyRoom.bridge.major;

import java.util.Collection;
import java.util.Collections;
import ru.jSkyRoom.interfaces.major.Perk;
import ru.jSkyRoom.interfaces.stub.JSkyScriptPackage;
import skyproc.Condition;
import skyproc.FormID;
import skyproc.PERK;
import skyproc.ScriptPackage;

/**
 *
 * @author Rakev
 */
public class PerkBridge extends DescriptionedMajorBridge<PERK> implements Perk {

    public PerkBridge(PERK adapting) {
        super(adapting);
    }

    @Override
    public JSkyScriptPackage getScriptPackage() {
        ScriptPackage scriptPackage = getRawObject().getScriptPackage();
        return getBridgeFactory().createBridge(scriptPackage);
    }

    @Override
    public Collection<Condition> getConditions() {
        Collection<Condition> result = getRawObject().getConditions();
        return Collections.unmodifiableCollection(result);
    }

    @Override
    public void addCondition(Condition condition) {
        getRawObject().addCondition(condition);
    }

    @Override
    public void removeCondition(Condition condition) {
        getRawObject().removeCondition(condition);
    }

    @Override
    public Perk getNextPerk() {
        FormID id = getRawObject().getNextPerk();
        return getFinderFactory().createPerkFinder().find(id);
    }

    @Override
    public void setNextPerk(Perk perk) {
        FormID id = getIdProducer().produce(perk);
        getRawObject().setNextPerk(id);
    }
}
